package com.yanger.dao;

import com.yanger.pojo.Department;
import org.springframework.stereotype.Repository;

import java.util.Collection;
import java.util.HashMap;


@Repository
public class DepartmentDao {

    private static HashMap<Integer, Department> departments = null;


    static {

        departments = new HashMap<>();

        departments.put(101,new Department(101,"A"));
        departments.put(102,new Department(102,"B"));
        departments.put(103,new Department(103,"C"));
        departments.put(104,new Department(104,"D"));
        departments.put(105,new Department(105,"E"));


    }

    public Collection<Department> getAllDepartment(){
        return departments.values();
    }

    public static Department getDepartById(int id){
        return departments.get(id);
    }


}

